package me.keiwu.pub.rpc;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * Created by kei on 21/11/2017.
 */
public interface ItemRpcPub {


    @RequestMapping("/rpc/item/suit/list")
    String listSuit(@RequestParam("page") int page, @RequestParam("size") int size);

    @RequestMapping("/rpc/item/suit/add")
    String addSuit(@RequestParam("name") String name,
                    @RequestParam("imgUrl") String imgUrl,
                    @RequestParam("itemDetail") String itemDetail,
                    @RequestParam("costGold") int costGold,
                    @RequestParam("shareGet") boolean shareGet,
                    @RequestParam("shelve") boolean shelve);


    @RequestMapping("/rpc/item/suit/update")
    String updateSuit(@RequestParam("itemId") Integer itemId,
                       @RequestParam("name") String name,
                       @RequestParam("imgUrl") String imgUrl,
                       @RequestParam("itemDetail") String itemDetail,
                       @RequestParam("costGold") int costGold,
                       @RequestParam("shareGet") boolean shareGet,
                       @RequestParam("shelve") boolean shelve);



    @RequestMapping("/rpc/item/single/list")
    String listSingle(@RequestParam("page") int page, @RequestParam("size") int size);

    @RequestMapping("/rpc/item/single/add")
    String addSingle(@RequestParam("name") String name,
                      @RequestParam("imgUrl") String imgUrl,
                      @RequestParam("costGold") int costGold,
                      @RequestParam("shareGet") boolean shareGet,
                      @RequestParam("shelve") boolean shelve,
                      @RequestParam("combItemsJson") String combItemsJson);


    @RequestMapping("/rpc/item/single/update")
    String updateSingle(@RequestParam("itemId") Integer itemId,
                         @RequestParam("name") String name,
                         @RequestParam("imgUrl") String imgUrl,
                         @RequestParam("costGold") int costGold,
                         @RequestParam("shareGet") boolean shareGet,
                         @RequestParam("shelve") boolean shelve,
                         @RequestParam("combItemsJson") String combItemsJson);




    @RequestMapping("/rpc/item/shelve")
    boolean shelve(@RequestParam("itemId") Integer itemId, @RequestParam("shelve") boolean shelve);


    @Component
    class Hystrix implements ItemRpcPub {

        @Override
        public String listSuit(int page, int size) {
            return null;
        }

        @Override
        public String addSuit(String name, String imgUrl, String itemDetail, int costGold,
                           boolean shelve, boolean shareGet) {
            return null;
        }

        @Override
        public String updateSuit(Integer itemId, String name, String imgUrl, String itemDetail,
                              int costGold, boolean shelve, boolean shareGet) {
            return null;
        }


        @Override
        public String listSingle(int page, int size) {
            return null;
        }

        @Override
        public String addSingle(String name, String imgUrl, int costGold, boolean shareGet, boolean shelve, String combItemsJson) {
            return null;
        }

        @Override
        public String updateSingle(Integer itemId, String name, String imgUrl, int costGold, boolean shareGet, boolean shelve, String combItemsJson) {
            return null;
        }

        @Override
        public boolean shelve(Integer itemId, boolean shelve) {
            return false;
        }
    }

}
